package cn.phecda.boot.data.mybatis.entity;

import cn.phecda.boot.data.core.entity.AuditEntity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.Version;
import io.swagger.v3.oas.annotations.media.Schema;

import java.util.Date;

/**
 * <p> 抽象审计实体 </p>
 *
 * @author : wanpinwei
 */
public abstract class AbstractAuditMybatisEntity implements AuditEntity {
    @Schema(description = "数据版本")
    @Version
    private Integer version;

    @Schema(description = "数据创建人")
    @TableField(value = "created_by", fill = FieldFill.INSERT)
    private String createdBy;

    @Schema(description = "数据创建时间")
    @TableField(value = "created_date", fill = FieldFill.INSERT)
    private Date createdDate;

    @Schema(description = "数据最后修改人")
    @TableField(value = "last_modified_by", fill = FieldFill.INSERT_UPDATE)
    private String lastModifiedBy;

    @Schema(description = "数据最后修改日期")
    @TableField(value = "last_modified_date", fill = FieldFill.INSERT_UPDATE)
    private Date lastModifiedDate;

    @Override
    public String getCreatedBy() {
        return createdBy;
    }

    @Override
    public Date getCreatedDate() {
        return createdDate;
    }

    @Override
    public String getLastModifiedBy() {
        return lastModifiedBy;
    }

    @Override
    public Date getLastModifiedDate() {
        return lastModifiedDate;
    }

    @Override
    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    @Override
    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    @Override
    public void setLastModifiedBy(String lastModifiedBy) {
        this.lastModifiedBy = lastModifiedBy;
    }

    @Override
    public void setLastModifiedDate(Date lastModifiedDate) {
        this.lastModifiedDate = lastModifiedDate;
    }

    @Override
    public Integer getVersion() {
        return version;
    }

    @Override
    public void SetVersion(Integer version) {
        this.version = version;
    }
}
